package com.examsys.service;

import javax.swing.JDialog;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.examsys.po.Admin;
import com.examsys.po.Users;
import com.examsys.view.LoginDialog;
/**
 * 系统入口类
 * @author edu-1
 *
 */
public class Main {

	public static Admin admin;//存放登录成功的管理员对象
	public static Users users;//存放登录成功的考试者对象
	public static ApplicationContext ac;
	static {
		ac = new FileSystemXmlApplicationContext("src/ApplicationContext.xml"); 
	}
	/**
	 * 获取业务逻辑层对象
	 * @param serviceName//存的是"adminRolesService"
	 * @return
	 * @throws Exception
	 */
	public static <T> T lookUp(String serviceName) throws Exception {
		return (T) ac.getBean(serviceName);
	}
	
	/**
	 * 程序的入口方法
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			//创建登录对话框
			LoginDialog dialog = new LoginDialog();
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);//当点击关闭按钮时销毁窗口
			dialog.setVisible(true);//设置对话框为可见
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
